package com.headfirst.CreateMode.factory.abstractfactory.pizzastore;

import com.headfirst.CreateMode.factory.abstractfactory.ingredientfactory.ChicagoIngredientFactory;
import com.headfirst.CreateMode.factory.abstractfactory.ingredientfactory.PizzaIngredientFactory;
import com.headfirst.CreateMode.factory.abstractfactory.pizza.*;

public class ChicagoPizzaStore extends PizzaStore{
    @Override
    protected Pizza createPizza(String type) {
        Pizza pizza = null;
        if(type == null){
            pizza = new OriginalFlavorPizza();
            pizza.setName("Original Flavor Pizza");
            return pizza;
        }
        
        // 制作pizza需要原料工厂（此处是芝加哥地区的披萨加盟店，需要的是芝加哥地区的原料工厂）
        PizzaIngredientFactory ingredientFactory = new ChicagoIngredientFactory();
        switch (type) {
            case "cheese":
                pizza = new CheesePizza(ingredientFactory);
                pizza.setName("Chicago Style Cheese Pizza");
                break;
            case "veggie":
                pizza = new VeggiePizza(ingredientFactory);
                pizza.setName("Chicago Style Veggie Pizza");
                break;
            case "clam":
                pizza = new ClamPizza(ingredientFactory);
                pizza.setName("Chicago Style Clam Pizza");
                break;
            case "pepperoni":
                pizza = new PepperoniPizza(ingredientFactory);
                pizza.setName("Chicago Style Pepperoni Pizza");
                break;
        }
        return pizza;
    }
}
